package cn.itcast.zt.java8.model.chain.demo1;

/**
 * 用户是否存在检查处理类
 * @author zhangtian105
 * @date 2023/2/1
 * @apiNote
 */
public class NullUserCheckFilter extends UserLoginCheckFilter{
    public NullUserCheckFilter(UserLoginCheckFilter userLoginCheckFilter) {
        super(userLoginCheckFilter);
    }

    @Override
    public UserLoginCheckFilter getNextFilter() {
        return super.getNextFilter();
    }

    @Override
    public boolean process(UserWrapper userWrapper) {
        if (null == userWrapper.getAuthUser()) {
            throw new RuntimeException("用户不存在");
        }

        return getNextFilter() == null ? true : getNextFilter().process(userWrapper);
    }
}
